Skip to content

Add USB send timeout (take 2) #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 15, 2016

Conversation

sandeepmistry
Copy link
Contributor

Replacement for #152.

This time I've used Paul Stoffregen's work on Teensy as inspiration.

The initial send timeout is 70ms, however if a send times out the next one will fail immediately if the previous write is not complete. A ZLP will be attempted to send if a timeout occurs, to detect the endpoint is ready to receive.

I've also removed the check for line state in Serial_::write. After opening the port the user or application can manually disable DTR or RTS.

@sandeepmistry
Copy link
Contributor Author

Hi @RamonRibes,

Could you please add this to your testing list with the WiFi101 web server example, it's a replacement for #152. You should not see any delays with the web server now if you open and close the Serial monitor on Windows.

So far I've tested with my Mac running OS X 10.11.3 and a Windows 10 VM.

@RamonRibes
Copy link

Hi, @sandeepmistry,
I've been testing the following sketch with this patch, opening and closing serial monitor:

void setup() {
  Serial.begin(9600);
  Serial.println("hello");

  pinMode(6, OUTPUT);
}

void loop() {
  Serial.println("LED HIGH");
  digitalWrite(6, HIGH);
  delay(1000);

  Serial.println("LED LOW");
  digitalWrite(6, LOW);
  delay(1000);
}

...and is working as expected.
I will keep on using this patch since now on.
Regards.

Timeout is checked on the next send attempt. Initial timeout is set to
70ms, after a time out occurs and the previous transfer is still not
complete a send will report as failed. If a send times out, a ZLP will
be in the send queue to check for future timeouts.
It’s no longer needed with the timeout mechanism in USBCore.
@sandeepmistry sandeepmistry force-pushed the usb-send-timeout-take-2 branch from f2aab04 to b2462a5 Compare August 31, 2016 15:31
@sandeepmistry
Copy link
Contributor Author

@cmaglie @facchinm I've rebased this, so it's ready for review and testing.

@sandeepmistry
Copy link
Contributor Author

@ArduinoBot is misbehaving a bit, however here's a new build:

✅ Build completed.

⬇️ Build URL: http://downloads.arduino.cc/PR/samd/package_samd-b97_index.json

ℹ️ To test this build:

  1. Open the Preferences of the Arduino IDE.
  2. Add the Build URL above in the Additional Boards Manager URLs field, and click OK.
  3. Open the Boards Manager (menu Tools->Board->Board Manager...)
  4. Install Arduino SAMD core - Pull Request Add USB send timeout (take 2) #154
  5. Select one of the boards under SAMD Pull Request Add USB send timeout (take 2) #154 in Tools->Board menu
  6. Compile/Upload as usual

@cmaglie
Copy link
Member

cmaglie commented Sep 14, 2016

Working OK for me 👍
(tested on Linux and Windows 10)

@sandeepmistry sandeepmistry force-pushed the usb-send-timeout-take-2 branch from ac0a30e to b2462a5 Compare September 14, 2016 14:19
@cmaglie cmaglie merged commit b2462a5 into arduino:master Sep 15, 2016
@sandeepmistry sandeepmistry deleted the usb-send-timeout-take-2 branch September 15, 2016 13:13
@cmaglie cmaglie added this to the Release 1.6.7 milestone Sep 26, 2016
boseji pushed a commit to go-ut/combined-ArduinoCore-samd that referenced this pull request May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants